class DailyHoroscopeModel {
  bool? success;
  int? code;
  String? message;
  DailyHoroscopeResult? data;

  DailyHoroscopeModel({
    this.success,
    this.code,
    this.message,
    this.data,
  });

  DailyHoroscopeModel.fromJson(Map<String, dynamic> json) {
    success = json['success'];
    code = json['code'];
    message = json['message'];
    data = json['data'] != null ? DailyHoroscopeResult.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['success'] = success;
    data['code'] = code;
    data['message'] = message;
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class DailyHoroscopeResult {
  String? lunarDate; // 农历
  String? solarDate; // 阳历
  HoroscopeDetail? careerHoroscope; // 事业运势
  String? heavenlyStemEarthlyBranch; // 干支
  HoroscopeDetail? loveHoroscope; // 爱情运势
  HoroscopeDetail? wealthHoroscope; // 财运运势
  String? bestZodiac; // 特吉属相
  String? goodZodiac; // 次吉属相
  int? luckyNumber; // 幸运位数
  String? luckyColor; // 幸运颜色
  String? careerBenefactor; // 事业贵人
  String? fortuneDirection; // 开运方向

  DailyHoroscopeResult({
    this.lunarDate,
    this.solarDate,
    this.careerHoroscope,
    this.heavenlyStemEarthlyBranch,
    this.loveHoroscope,
    this.wealthHoroscope,
    this.bestZodiac,
    this.goodZodiac,
    this.luckyNumber,
    this.luckyColor,
    this.careerBenefactor,
    this.fortuneDirection,
  });

  void fromJson(Map<String, dynamic> json) {
    lunarDate = json['农历'];
    solarDate = json['阳历'];
    careerHoroscope = json['事业运势'] != null ? HoroscopeDetail.fromJson(json['事业运势']) : null;
    heavenlyStemEarthlyBranch = json['干支'];
    loveHoroscope = json['爱情运势'] != null ? HoroscopeDetail.fromJson(json['爱情运势']) : null;
    wealthHoroscope = json['财运运势'] != null ? HoroscopeDetail.fromJson(json['财运运势']) : null;
    bestZodiac = json['特吉属相'];
    goodZodiac = json['次吉属相'];
    luckyNumber = json['幸运位数'] != null ? int.tryParse(json['幸运位数'].toString()) : null;
    luckyColor = json['幸运颜色'];
    careerBenefactor = json['事业贵人'];
    fortuneDirection = json['开运方向'];
  }

  DailyHoroscopeResult.fromJson(Map<String, dynamic> json) {
    fromJson(json);
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['农历'] = lunarDate;
    data['阳历'] = solarDate;
    if (careerHoroscope != null) {
      data['事业运势'] = careerHoroscope!.toJson();
    }
    data['干支'] = heavenlyStemEarthlyBranch;
    if (loveHoroscope != null) {
      data['爱情运势'] = loveHoroscope!.toJson();
    }
    if (wealthHoroscope != null) {
      data['财运运势'] = wealthHoroscope!.toJson();
    }
    data['特吉属相'] = bestZodiac;
    data['次吉属相'] = goodZodiac;
    data['幸运位数'] = luckyNumber;
    data['幸运颜色'] = luckyColor;
    data['事业贵人'] = careerBenefactor;
    data['开运方向'] = fortuneDirection;
    return data;
  }
}

class HoroscopeDetail {
  int? star; // 星级
  String? description; // 描述

  HoroscopeDetail({
    this.star,
    this.description,
  });

  void fromJson(Map<String, dynamic> json) {
    star = json['star'] != null ? int.tryParse(json['star'].toString()) : null;
    description = json['desc'];
  }

  HoroscopeDetail.fromJson(Map<String, dynamic> json) {
    fromJson(json);
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['star'] = star;
    data['desc'] = description;
    return data;
  }
}
